<template>
	<view class="li" @click="goDetail">
		<view class="img-box">
			<image :src="item.picurl" mode="widthFix" ></image>
			<!-- <m-image :src="item.picurl"  wh="345" mode="widthFix" radius="20 20 0 0 "
				@load="onImageLoad" @error="onImageError" /> -->
		</view>
		<m-block gap="15 20" >
			<m-text block gap="0 0 10 0" ftsize="28" className="title opt2" >{{ item.goodsName }}</m-text>
			<m-text block className="otw" color="#999" ftsize="24" spa="0 0 10 0" v-if="item.sketch">{{item.sketch}}</m-text>
			<view class="flex-between">
				<m-number :cny="item.coinid != 2" unit="积分" size="30 24" :value="item.price" color="#846CFF"></m-number>
				<m-text color="#999999" v-if="hideShop">已售 {{ item.totalSell | tranNumber2(0) }}</m-text>
			</view>
		</m-block>
		<!-- <view class="discounts">
			<m-tag text="新品" bordercolor="#FA2B47" bgColor="#FA2B47" v-if="item.isnew==1" />
			<m-tag text="特价" v-if="item.isBargain ==1" />
			<m-tag text="爆款" bordercolor="#FA2B47" bgColor="#FA2B47" color="#FA2B47" hollow   border="1" v-if="item.ishot ==1" />
			<m-tag text="推荐" bordercolor="#FF6619" bgColor="#FF6619" color="#FF6619" hollow   border="1" v-if="item.istop==1" />
		</view> -->
		<!-- <view class="evaluate pl20 flex">
			<text>{{item.ccount}}条评价</text>
			<text>|</text>
			<text>综合评分{{item.fine}}</text>
		</view> -->
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		name: 'goodsCard',
		data() {
			return {};
		},
		props: {
			item: {
				type: Object,
				default: {}
			},
			hideShop: {
				type: Boolean,
				default: true,
			}
		},
		computed: {
			...mapState({
				userbalance: state => state.user.userbalance,
				enum: state => state.general.enum,
			}),
			Coin() {
				return this.enum['Coin']
			},
			// des() {
			// 	if (!this.item.goodsDescription) return [];
			// 	console.log(this.item.goodsDescription.split(','));
			// 	return this.item.goodsDescription.split('，');
			// },
			// goodsPictureList() {
			// 	return this.item.goodsPictureList || [];
			// },
			Picture() {
				return;
			}
		},
		methods: {
			goDetail() {
				// if ([2, 3].indexOf(this.item.wards) != -1) {
				// 	this.Jump('/pages/coupon/details/details?id=' + this.item.id)
				// 	return
				// }
				this.Jump('/pagesA/shopping/goodsdetail/goodsdetail?id=' + this.item.id)
			},
		},
	};
</script>

<style lang="scss">
	.li {
		background: #fefefe;
		box-shadow: 0px 0px 16rpx 0px rgba(122, 122, 122, 0.22);
		border-radius: 20rpx;
		position: relative;
		box-sizing: border-box;
		overflow: hidden;
		.img-box {
			width: 100%;
			border-radius: 20rpx 20rpx 0 0;
			overflow: hidden;
			image{
				background: #fff;
				width: 100%;
			}
			
		}
	}

	.evaluate {
		width: 100%;

		text {
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #999999;
			padding-right: 10rpx;
		}

		.totals {
			font-size: 22rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #999999;
		}
	}

	.pl20 {
		padding: 0rpx 16rpx 20rpx;
	}
</style>